import React, {useContext, useEffect, useState} from 'react';
import { Alert, View ,ImageBackground} from 'react-native';
import { Button, Image, Text } from 'react-native-elements';

import LocaleContext from '../libs/locale';

import WebBrowser from '../components/WebComponentP'
import WalletContext from "../libs/wallet";

const WebBrowserMessage = ({ navigation ,route}: any) => {
  const locale = useContext(LocaleContext);
  const wallet: any = useContext(WalletContext);
  const [isUpdateAlert, setIsUpdateAlert] = useState(0);
  const url = route?.params?.url || false;
  const address = route?.params?.address || null;
  const showExplore = route?.params?.showExplore || false;
  const title = route?.params?.title || "区块浏览器";
  const headerShownFalse = route?.params?.headerShownFalse || false;


  useEffect(()=>{
    navigation.setOptions({ headerShown:!headerShownFalse,title: title, })
  },[])

  return (
      // @ts-ignore
      <WebBrowser url={url} address={address} showExplore={showExplore} title={title} navigation={navigation} locale={locale} wallet={wallet}/>
  );
};

export default WebBrowserMessage;
